
import request from '@/utils/request'
/***
 * 返回省份
 */
export function getProvince(data) {
    return request({
        url: `/api/province/all`,
        //post请求
        method: 'post',
        data
    })
}

//获取省id
export function getProvinceId(data) {
    return request({
        url: `/api/province/queryid/${data.name}`,
        //post请求
        method: 'post',
        data
    })
}

//获取省名
export function getProvinceName(data) {
    return request({
        url: `/api/province/queryname/${data.id}`,
        //post请求
        method: 'post',
        data
    })
}

//获取省下所有市
export function getCity(data) {
    return request({
        url: `/api/city/query/${data.id}`,
        //post请求
        method: 'post',
        data
    })
}

//获取市Id
export function getCityId(data) {
    return request({
        url: `/api/city/queryid/${data.name}`,
        //post请求
        method: 'post',
        data
    })
}

//获取市名
export function getCityName(data) {
    return request({
        url: `/api/city/queryname/${data.id}`,
        //post请求
        method: 'post',
        data
    })
}

//获取市下所有区
export function getDistrict(data) {
    return request({
        url: `/api/district/query/${data.id}`,
        //post请求
        method: 'post',
        data
    })
}

//获取区名
export function getDistrictName(data) {
    return request({
        url: `/api/district/queryname/${data.id}`,
        //post请求
        method: 'post',
        data
    })
}

//提交地址
export function submitAddress(data) {
    return request({
        url: `/api/useraddress/add`,
        //post请求
        method: 'post',
        data
    })
}

//改变默认地址
export function changeDefault(data) {
    return request({
        url: `/api/useraddress/changeDefault/${data.id}`,
        //post请求
        method: 'post',
        data
    })
}

//获取用户地址
export function getAddress(data) {
    return request({
        url: `/api/useraddress/all/${data.id}`,
        //post请求
        method: 'post',
        data
    })
}

export function deleteAddress(data) {
    return request({
        url: `/api/useraddress/delete/${data.id}`,
        //post请求
        method: 'post',
        data
    })
}